package com.ft.oa.domain.development;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ft.oa.utils.SecurityUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * 研发需求-下发表
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class DevNeedIssue {


    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 新增日期
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;


    //下发start
    /**
     * 研发需求编号
     */
    private String devNeedNo;

    /**
     * 研发需求类别
     */
    private String devNeedCategory;
    /**
     * 产品类别id
     */
    private Long productCategoryId;
    /**
     * 产品类别
     */
    private String productCategory;
    /**
     * 产品版本
     */
    private String productVersion;
    /**
     * 分流方向
     */
    private String shuntDirection;
    /**
     * 研发模式
     */
    private String devModel;
    /**
     * 下发版本号
     */
    private String issueVersion;

    /**
     * 下发备注
     */
    private String issueRemarks;

    //下发end
    /**
     * 下发状态，0下发，1回滚,2分配
     */
    private Integer dataState;

    /**
     * 页数
     */
    @TableField(exist = false)
    private int page;
    /**
     * 每页条数
     */
    @TableField(exist = false)
    private int size;

    /**
     * 创建人id
     */
    private Long creator = SecurityUtils.getCurrentUser().getId();

    /**
     * 修改时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime = LocalDateTime.now();

    /**
     * 修改人id
     */
    private Long editor = SecurityUtils.getCurrentUser().getId();

    public DevNeedIssue(DevNeed need) {

        this.createTime = LocalDateTime.now();

        this.devNeedCategory = need.getDevNeedCategory();
        this.productCategoryId = need.getProductCategoryId();
        this.productCategory = need.getProductCategory();
        this.productVersion = need.getProductVersion();
        this.shuntDirection = need.getShuntDirection();
        this.devModel = need.getDevModel();
        this.issueVersion = need.getIssueVersion();
        this.issueRemarks = need.getIssueRemarks();

    }
}
